home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Classes / SocketClasses / util.h < prev   
Encoding:
C/C++ Source or Header  |  1992-07-23  |  4.9 KB  |  88 lines

  1. /***************************************************************************
  2. *                                                                          *
  3. * util.h                                                                   *
  4. * Copyright 1992 by Nik A Gervae                                           *
  5. *                                                                          *
  6. * For use with the three Objective-C classes (SktSocketManager, SktSocket, *
  7. * and SktSocketUser) which implement a convenient interface to Berkeley    *
  8. * stream sockets under NeXTSTEP(r).  See the accompanying class            *
  9. * specifications (files with a .rtf or .spec suffix) for further           *
  10. * information.                                                             *
  11. *                                                                          *
  12. * NeXTSTEP is a registered trademark of NeXT Computer, Inc.                *
  13. *                                                                          *
  14. ****************************************************************************
  15. *                                                                          *
  16. * LICENSE                                                                  *
  17. *                                                                          *
  18. * This program is free software; you can redistribute it and/or modify     *
  19. * it under the terms of the GNU General Public License as published by     *
  20. * the Free Software Foundation.                                            *
  21. *                                                                          *
  22. * The program and this makefile are distributed in the hope that it will   *
  23. * be useful, but are provided "AS IS" AND WITHOUT ANY WARRANTY; without    *
  24. * any express or implied warranty of MERCHANTABILITY or FITNESS FOR A      *
  25. * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
  26. * Any use or distribution of the program and documentation must include    *
  27. * appropriate copyrights to acknowledge Nik A. Gervae and the Free         *
  28. * Software Foundation, Inc.                                                *
  29. * The program and this makefile are distributed in the hope that it will   *
  30. * be useful, but are provided "AS IS" AND WITHOUT ANY WARRANTY; without    *
  31. * any express or implied warranty of MERCHANTABILITY or FITNESS FOR A      *
  32. * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
  33. * Any use or distribution of the program and documentation must include    *
  34. * appropriate copyrights to acknowledge Nik A. Gervae and the Free         *
  35. * Software Foundation, Inc.                                                *
  36. *                                                                          *
  37. * You should have received a copy of the GNU General Public License        *
  38. * along with this program; if not, write to the Free Software              *
  39. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                *
  40. *                                                                          *
  41. ****************************************************************************
  42. *                                                                          *
  43. * VERSION HISTORY                                                          *
  44. *                                                                          *
  45. * Version numbers are simply dates in the form YYYYMMDD.  These represent  *
  46. * the date that version was finished.  Only significantly changed versions *
  47. * are reported here, or those versions requiring explanation of changes.   *
  48. * There may be many interim stages between dated versions.                 *
  49. *                                                                          *
  50. * DateVersion Primary Author  Notes                                        *
  51. * ----------- --------------- -------------------------------------------- *
  52. * 19920327    Nik A Gervae    First released version                       *
  53. *                                                                          *
  54. ***************************************************************************/
  55.  
  56. #import <stdio.h>
  57. #ifdef NS3
  58. #import <objc/zone.h>
  59. #else
  60. #import <zone.h>
  61. #endif
  62.  
  63.  
  64. // Macros
  65.  
  66. #ifndef    MIN
  67. #define    MIN(a,b) (((a) < (b)) ? (a) : (b))
  68. #endif    MIN
  69. #ifndef    MAX
  70. #define    MAX(a,b) (((a) > (b)) ? (a) : (b))
  71. #endif    MAX
  72.  
  73. #define ISENDLINE(c)  ((c) == '\n' || (c) == '\r')
  74. #define ISWHITE(c)    ((c) == ' ' || (c) == '\t')
  75. #define CRLF          "\r\n"
  76. #define ISCRLF(s)     ((*(s)) == '\r' && (*((s)+1)) == '\n')
  77. #define ISOPENENT(s)  ((*(s)) == '@'  && (*((s)+1)) == '+')
  78. #define ISCLOSEENT(s) ((*(s)) == '@'  && (*((s)+1)) == '-')
  79.  
  80. // Functions
  81.  
  82. int   rstrncmp(const char *str1, const char *str2, int len);
  83. char *strdup(const char *string);
  84. char *strrecat(const char *string1,const char *string2);
  85.  
  86. char *zoneStrdup(NXZone *zonep, const char *string);
  87. char *zoneStrrecat(NXZone *zonep, const char *string1,const char *string2);
  88.